#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main()
{
    ll n;
    cin >> n;
    ll ans = 0;
    ll cnt = 0,x=1;
    vector<ll> a(n+1);
    for(ll i=1;i<=n;i++)
    {
        cin >> a[i];
        ans = ans + x*a[i];
        cnt++;
        if(cnt==2)
        {
            cnt = 0;
            x *= -1;
        }
    }
    cout << ans << endl;
}